import moment from 'moment'

export const getOrderId = () => {
  // 生成6位随机数
  let randomStr = ''
  for (let i = 1; i <= 6; i++) {
    randomStr += Math.floor(Math.random() * 10)
  }
  return moment().format('YYYYMMDDHHmmss') + randomStr
}

// 将时间戳转化为日期格式
export const unixToformatDate = (timestamp, format = 'YYYY-MM-DD HH:mm:ss') => {
  return moment.unix(timestamp).format(format)
}